package com.clock.message.listener;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.clock.message.pojo.NcMessage;
import com.clock.message.service.MessageService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RocketMQMessageListener(topic = "allowedJoinCompanyTopic", consumerGroup = "allowedJoinCompanyConsumer")
public class AllowedJoinCompanyListener implements RocketMQListener<String> {
    @Autowired
    private MessageService messageService;


    @Override
    public void onMessage(String message) {
        log.info("接收到消息" + message);
        try {
            messageService.updateMessageWithApproved(message);
        }catch (Exception e){
            log.error("接收到加入团队审核通过的消息，发生异常：", e);
        }
    }
}
